package com.peaw.access.controller.annotation;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.peaw.exception.PeawException;

@Controller
public class HelloController {

	@RequestMapping("/hello")
	public String hello() throws Exception {
		try {

			Date date = new Date();
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Date limiteddate = sdf.parse(Util.anaLicenceCode());
			if (date.compareTo(limiteddate) > 0) {
				throw new PeawException("访问受限！");
			}

		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
		return "hello";
	}


}
